<?php
declare (strict_types = 1);

namespace app\middleware;

class ManageAuth
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        if(($request->controller(true)=='login' and $request->action()=='index') or $request->pathinfo()=='captcha.html'){
            return $next($request);
        }else{
            if(session('?uid')){
                return $next($request);
            }else{
                return redirect('/manage.php/login/index.html');
            }
        }
    }
}
